/**
 * 
 */
package org.chengsen.config;

import java.io.IOException;
import java.util.Properties;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;

/**
 * property文件相关的config，取得和配置各种property
 * 
 * @author Jason.zhang
 * 
 */
@Configuration
@PropertySource("classpath:property/dataSource.properties")
public class PropertyConfig {

	@Bean(name = "hibernateProperties")
	public Properties hibernateProperties() {
		Properties props = new Properties();
		try {
			props.load(new ClassPathResource("property/hibernate.properties")
					.getInputStream());
		} catch (IOException e) {
			e.printStackTrace();
		}
		return props;
	}

	@Bean
	public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer()
			throws IOException {
		return new PropertySourcesPlaceholderConfigurer();
	}
}
